package com.redrose.demo.base;

import android.util.Log;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.OnLifecycleEvent;

/**
 * Activity 生命周期监听
 */
public class MyObserver implements LifecycleObserver {
    private static final String TAG = "MyObserver";
    @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
    void onCreateX(LifecycleOwner owner){
        Log.d(TAG, "onCreateX: ");
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    void onStartX(LifecycleOwner owner){
        Log.d(TAG, "onStartX: ");
    }
    @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
    void onDestroyX(LifecycleOwner owner) {
        Log.d(TAG, "onDestroyX: ");
    }
}
